<?php

/**
 * @author      : PhuongTN
 * @version     : 2012
 * @copyright   : FO
 * @name        : hethao_modules_block_business_block_metadata_layout
 * @todo        : Format data for layout
 */
class Fpt_Business_Block_section_metadata_section
{
    /**
     *
     * @var int
     */
    private $SectionID = 0;
    /**
     * safename
     * @var varchar(100) 
     */
    private $SectionName = '';
    /**
     *
     * @var varchar(100) 
     */
    private $SectionTitle = '';
    private $SectionDesc = '';
    
    /**
     *
     * @var int(11) 
     */
    private $CreateDate = 0;
    /**
     *
     * @var int(11) 
     */
    private $ModifyDate = 0;
    /**
     *
     * @var int(11) 
     */
    private $LayoutName = 0;
    /**
     *
     * @var int(11) 
     */
    private $Status = 0;

    public function __construct()
    {
        $this->SectionID = 0;
        $this->SectionName = '';
        $this->SectionTitle = '';
        $this->SectionDesc = '';
        $this->CreateDate = 0;
        $this->ModifyDate = 0;
        $this->LayoutName = 0;
        $this->Status = 0;
    }

    public function __destruct()
    {
        unset($this->SectionID, $this->SectionName, $this->SectionTitle, $this->SectionDesc,
              $this->CreateDate, $this->ModifyDate, $this->LayoutName, $this->Status);
    }

    /**
     * Init data
     * @param array $entity (SectionName,SectionTitle,CreateDate,ModifyDate,LayoutName,Status)
     * @return  Fpt_Business_Block_block_metadata_layout
     */
    public function init($entity)
    {
        if(isset($entity['SectionID']))
        {
            $this->SectionID     = intval($entity['SectionID']);
        }
        $this->SectionTitle  = isset($entity['SectionTitle'])?$entity['SectionTitle']:'';
        $this->SectionName = isset($entity['SectionName'])?Fpt_Global::covertVN($entity['SectionName']):'';
        $this->SectionDesc  = isset($entity['SectionDesc'])?$entity['SectionDesc']:'';
        $this->CreateDate = intval($entity['CreateDate']);
        $this->ModifyDate = intval($entity['ModifyDate']);
        $this->LayoutName = isset($entity['LayoutName'])?Fpt_Global::covertVN($entity['LayoutName']):'';
        $this->Status   = intval($entity['Status']);
        return $this;
    }

    /**
     * Format data
     * @return array 
     */
    public function getData()
    {
        return array(
            'SectionID'      => $this->SectionID,
            'SectionName'    => $this->SectionName,
            'SectionTitle'   => $this->SectionTitle,
            'SectionDesc'     => $this->SectionDesc,
            'LayoutName'      => $this->LayoutName,
            'CreateDate'    => $this->CreateDate,
            'ModifyDate'    => $this->ModifyDate,
            'Status'        => $this->Status,
        );
    }
    /**
     * 
     * @return type 
     */
    public function getDataCache()
    {
        return array(
            'SectionName'   => $this->SectionName,
            'SectionTitle'  => $this->SectionTitle,
            'LayoutName'      => $this->LayoutName,
            'SectionDesc'     => $this->SectionDesc,
        );
    }
}